package com.budwk.app.sqfwV2.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.stream.Collectors;

@Getter
@AllArgsConstructor
public enum CaringStaffEnum {
    A(1,"走访慰问","sqfwV2/caringStaff/zfww.docx","党员走访慰问记录表","sqfwV2/caringStaff/templet/社区（村）走访慰问记录表.docx","/preview/ga/zfww.png"),
    B(2,"定期访视","sqfwV2/caringStaff/dqfs01.docx","观山湖区定期访视记录表","sqfwV2/caringStaff/templet/观山湖区定期访视记录表.docx","/preview/ga/dqfs.png"),
    C(3,"走访慰问","sqfwV2/caringStaff/dyga.xlsx","党员关爱走访台账","sqfwV2/caringStaff/templet/党员关爱走访台账.xlsx","/preview/ga/gatz.png"),
    D(4,"定期访视","sqfwV2/caringStaff/dqfs.docx","观山湖区定期访视记录表","sqfwV2/caringStaff/templet/观山湖区定期访视记录表.docx",""),
    ;
    private  int code;
    private  String name;
    private  String templat;
    private  String fileName;
    private  String blankTemplate;
    private  String previewImage;


    public static String getFileName(String name){
        String filename = Arrays.asList(CaringStaffEnum.values())
                .stream()
                .filter(e -> name .equals(e.getName())&&e.getCode()<=2 )
                .collect(Collectors.toList())
                .get(0)
                .getFileName();
        return filename;
    }



    public static int getCode(String name){
        int value = Arrays.asList(CaringStaffEnum.values())
                .stream()
                .filter(e -> name .equals(e.getName()))
                .collect(Collectors.toList())
                .get(0)
                .getCode();
        return value;
    }

    public static String getBlankTemplate(Integer code){
        String blankTemplate = Arrays.asList(CaringStaffEnum.values())
                .stream()
                .filter(e -> code .equals(e.getCode()) )
                .collect(Collectors.toList())
                .get(0)
                .getBlankTemplate();
        return blankTemplate;
    }
    public static String getName(Integer code){
        String name = Arrays.asList(CaringStaffEnum.values())
                .stream()
                .filter(e -> code .equals(e.getCode()) )
                .collect(Collectors.toList())
                .get(0)
                .getName();
        return name;
    }


    public static String getPdfTemplatName(String name){
        String templat = Arrays.asList(CaringStaffEnum.values())
                .stream()
                .filter(e -> name .equals(e.getName())&&e.getCode()<=2 )
                .collect(Collectors.toList())
                .get(0)
                .getTemplat();
        return templat;
    }

    public static String getPdfTemplat(Integer code){
        String templat = Arrays.asList(CaringStaffEnum.values())
                .stream()
                .filter(e ->  code .equals(e.getCode()) )
                .collect(Collectors.toList())
                .get(0)
                .getTemplat();
        return templat;
    }
    public static String getFileName(Integer code){
        String fileName = Arrays.asList(CaringStaffEnum.values())
                .stream()
                .filter(e -> code .equals(e.getCode()) )
                .collect(Collectors.toList())
                .get(0)
                .getFileName();
        return fileName;
    }



}
